using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using SpecListSPC;
using System.IO;




namespace ArchSoft
{
    public partial class ScheduleInfFrm : Form
    {
        private string _folderPath;

        DataTable SumTbl;
        DataTable tmpTb;

        public string FolderPath
        {
            set { _folderPath = value; }
        }

        public ScheduleInfFrm()
        {
            InitializeComponent();
            SumTbl = new DataTable("SCHEDULE.INF");
            SumTbl.Columns.Add("Element");
            SumTbl.Columns.Add("Drawing");
            SumTbl.Columns.Add("Start");
            SumTbl.Columns.Add("End");
            SumTbl.Columns.Add("Status");

            SumTbl.Constraints.Add("Key", SumTbl.Columns[0], true);

            tmpTb = SumTbl.Copy();
        }

        private void ScheduleInfFrm_Load(object sender, EventArgs e)
        {
            string[] dir = Directory.GetDirectories(_folderPath);

            foreach (string fol in dir)
            {
                if (Path.GetFileNameWithoutExtension(fol).IndexOf("Xref") > 0)
                    continue;

                foreach (string file in Directory.GetFiles(fol))
                {
                    if (Path.GetExtension(file).ToLower() != "dwg")
                    {
                        GLItem nit = new GLItem();
                        GLSubItem sit1 = new GLSubItem();
                        GLSubItem sit2 = new GLSubItem();
                        GLSubItem sit3 = new GLSubItem();
                        GLSubItem sit4 = new GLSubItem();
                        GLSubItem sit5 = new GLSubItem();

                        sit1.Text = Path.GetFileNameWithoutExtension(fol);
                        sit2.Text = Path.GetFileName(file);
                        sit3.Text = DateTime.Now.ToString();
                        sit4.Text = DateTime.Now.ToString();
                       

                        nit.SubItems.AddRange(new GLSubItem[] { sit1, sit2, sit3, sit4, sit5 });
                        specList1.Items.Add(nit);
                    }
                }

            }
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }
    }
}